"""Definition of the Dependencia content type
"""

from AccessControl import ClassSecurityInfo

from zope.interface import implements, directlyProvides

from Products.Archetypes import atapi
from Products.ATContentTypes.content import base
from Products.ATContentTypes.content import schemata

from guegue.alcaldias import alcaldiasMessageFactory as _
from guegue.alcaldias.interfaces import IDependencia
from guegue.alcaldias.config import PROJECTNAME

DependenciaSchema = schemata.ATContentTypeSchema.copy() + atapi.Schema((

    # -*- Your Archetypes field definitions here ... -*-
    atapi.StringField('title',
                searchable=1,
                isMetadata=0,
                accessor='Title',
                storage=atapi.AnnotationStorage(), 
                widget=atapi.StringWidget(label='Nombre de la Dependencia',
                                      maxlength=150,
                                      size=30,
                                      label_msgid="label_entry_title",
                                      description_msgid="help_entry_title",
                                      i18n_domain="guegue.alcaldias",
                                      description='')),
    atapi.StringField('description',
                searchable=1,
                isMetadata=0,
                accessor='Description',
                widget=atapi.TextAreaWidget(label='Descripcion',
                                      label_msgid="label_entry_description",
                                      description_msgid="help_entry_description",
                                      i18n_domain="guegue.alcaldias",
                                      description='')),
    atapi.TextField('funciones',
                searchable=1,
                default_content_type='text/html',
                default_output_type='text/html',
                allowable_content_types=('text/plain','text/structured', 'text/html', 'text/restructured'),
                widget=atapi.RichWidget(label='Funciones',
                                      label_msgid="label_entry_funciones",
                                      description_msgid="help_entry_funciones",
                                      i18n_domain="guegue.alcaldias",
                                      description='')),
    atapi.StringField('responsable',
                searchable=1,
                isMetadata=0,
                widget=atapi.StringWidget(label='Funcionario responsable',
                                      maxlength=150,
                                      size=30,
                                      label_msgid="label_entry_responsable",
                                      description_msgid="help_entry_responsable",
                                      i18n_domain="guegue.alcaldias",
                                      description='')),
    atapi.StringField('total',
                searchable=1,
                isMetadata=0,
                widget=atapi.StringWidget(label='Total de Funcionarios',
                                      maxlength=4,
                                      size=4,
                                      label_msgid="label_entry_total",
                                      description_msgid="help_entry_total",
                                      i18n_domain="guegue.alcaldias",
                                      description='Total de Funcionarios en la Dependencia')),
    atapi.StringField('direccion',
                searchable=1,
                isMetadata=0,
                widget=atapi.StringWidget(label='Dirección Física',
                                      label_msgid="label_entry_direccion",
                                      description_msgid="help_entry_direccion",
                                      i18n_domain="guegue.alcaldias",
                                      description='')),
    atapi.StringField('telefono',
                searchable=0,
                isMetadata=0,
                required=1,
                widget=atapi.StringWidget(label='Teléfono',
                                      label_msgid="label_entry_telefono",
                                      description_msgid="help_entry_telefono",
                                      i18n_domain="guegue.alcaldias",
                                      description='')),
    atapi.StringField('correo',
                searchable=0,
                isMetadata=0,
                required=1,
                widget=atapi.StringWidget(label='Correo Electrónico',
                                      label_msgid="label_entry_correo",
                                      description_msgid="help_entry_correo",
                                      i18n_domain="guegue.alcaldias",
                                      description='')),
    atapi.StringField('horario',
                searchable=1,
                isMetadata=0,
                widget=atapi.StringWidget(label='Horario de Atención',
                                      label_msgid="label_entry_horario",
                                      description_msgid="help_entry_horario",
                                      i18n_domain="guegue.alcaldias",
                                      description='')),
))

# Set storage on fields copied from ATContentTypeSchema, making sure
# they work well with the python bridge properties.

schemata.finalizeATCTSchema(DependenciaSchema, moveDiscussion=False)

class Dependencia(base.ATCTContent):
    """Tipo de datos para dependencias"""
    implements(IDependencia)

    portal_type = "Dependencia"
    schema = DependenciaSchema

    #title = atapi.ATFieldProperty('title')
    #description = atapi.ATFieldProperty('description')

atapi.registerType(Dependencia, PROJECTNAME)
